package com.pie4cloud.pie.job.biz.util;


import com.pie4cloud.pie.job.api.entity.JobInfoEntity;

import javax.persistence.DiscriminatorValue;

public class JobInfoUtils {

	/**
	 *
	 * @param t  对象
	 * @param <T>
	 * @return
	 * @throws Exception
	 */
	public static <T extends JobInfoEntity> String getDiscriminatorValue(T t) throws Exception {

		Class<? extends JobInfoEntity> tClass = t.getClass();
		if(tClass.isAnnotationPresent(DiscriminatorValue.class)) {
			DiscriminatorValue annotation = tClass.getAnnotation(DiscriminatorValue.class);
			return annotation.value();
		} else {
			throw new Exception("未找到对应注解！");
		}
	}

	public static void main(String[] args) throws Exception {
	}
}
